{% extends 'base.html' %}

{% block menu %}

    <div id='menu'>
      <ul>
        {% if is_on_leave %}
        <li class="on_leave"><a href="/entelib/profile/onleave/">YOU ARE ON LEAVE</</a></li>
        {% endif %}

        {% if can_list_books %}
            <li><a href="/entelib/books/">Books</a>
                {% if perms.baseapp.list_users %}
                    <ul>
                        <li><a href="/entelib/books/">Find a book</a></li>
                        <li class="separator"></li>
                        {% if can_add_bookrequest %}            <li><a href="{% url bookrequest_add %}">          Request a book        </a></li> {% endif %}
                        {% if perms.baseapp.list_bookrequests %}
                            <li><a href="{% url bookrequest_active %}">       Book request list     </a></li>
                        {% endif %}
                        {% if perms.baseapp.add_book %}        <li><a href="{% url book_add %}">                  Add a book              </a></li>
                          <li class="separator"></li>
                        {% endif %}
        		{% if user.get_profile.is_librarian %}   <li><a href="{% url category_add %}">            Add category          </a></li> {% endif %}
                        {% comment %} The following seems to obstruct librarians
                            {% if perms.baseapp.list_authors %}    <li><a href="/entelib/authors/">                   Author list           </a></li> {% endif %}
                            {% if perms.baseapp.add_author %}      <li><a href="{% url author_add %}">                Add author            </a></li>
                              <li class="separator"></li>
                            {% endif %}
                            {% if perms.baseapp.list_categories %}   <li><a href="/entelib/categories/">              Category list         </a></li> {% endif %}
                            {% if perms.baseapp.add_category %}      <li><a href="{% url category_add %}">            Add category          </a></li>
                              <li class="separator"></li>
                            {% endif %}
                            {% if perms.baseapp.list_publishers %}    <li><a href="/entelib/publishers/">             Publisher list        </a></li> {% endif %}
                            {% if perms.baseapp.add_publisher %}      <li><a href="{% url publisher_add %}">          Add publisher         </a></li>
                              <li class="separator"></li>
                            {% endif %}
                            {% if perms.baseapp.list_costcenters %}    <li><a href="/entelib/costcenters/">           Costcenter list       </a></li> {% endif %}
                            {% if perms.baseapp.add_costcenter %}      <li><a href="{% url costcenter_add %}">        Add costcenter        </a></li>
                              <li class="separator"></li>
                            {% endif %}
                            {% if perms.baseapp.list_states %}    <li><a href="/entelib/states/">                     State list            </a></li> {% endif %}
                            {% if perms.baseapp.add_state %}      <li><a href="{% url state_add %}">                  Add state             </a></li>
                              <li class="separator"></li>
                            {% endif %}
                        {% endcomment %}
                    </ul>
                {% endif %}
            </li>
        {% endif %}
        {% if not perms.baseapp.list_users and can_add_bookrequest %}
            <li><a href="{% url bookrequest_add %}">Request a book</a></li>
        {% endif %}

        {% if can_view_own_profile %}   <li><a href="/entelib/profile/"> My profile  </a>
          {% if can_list_users %}
              <ul>
                  <li><a href="/entelib/profile/">                     Show my profile       </a>
                  <li><a href="/entelib/profile/rentals/">             My rentals            </a></li>
                  <li><a href="/entelib/profile/reservations/">        My reservations       </a></li>
                  <li><a href="/entelib/profile/config/">              Configuration         </a></li>
              </ul>
          {% endif %}
        {% endif %}
        </li>
        {% if not can_list_users %}
              <li><a href="/entelib/profile/rentals/">             My rentals            </a></li>
              <li><a href="/entelib/profile/reservations/">        My reservations       </a></li>
              <li><a href="/entelib/profile/config/">              Configuration         </a></li>
        {% endif %}

        {% if user.get_profile.is_librarian %}
            {% comment %}
            This is drop down menu for librarian. Currently we use solid menu.
              <li>
                <a href="/entelib/shipment">Work</a>
                  <ul>
                        <li><a href="/entelib/shipment">              Shipment requests     </a></li>
                        <li><a href="/entelib/current_reservations/"> Current reservations  </a></li>
                        <li><a href="/entelib/current_rentals/">      Current rentals       </a></li>
                  </ul>
              </li>
            {% endcomment %}
            <li><a href="/entelib/shipment">              Shipment requests     </a></li>
            <li><a href="/entelib/current_reservations/"> Current reservations  </a></li>
            <li><a href="/entelib/current_rentals/">      Current rentals       </a></li>
        {% endif %}


        {% if can_list_users %}
            <li>
                <a href="/entelib/users/">User list</a>
                {% if perms.auth.change_user or perms.auth.add_user %}
                    <ul>
                        {% if perms.baseapp.list_users %}<li><a href="/entelib/users/">Show user list</a></li> {% endif %}
                        {% if perms.auth.add_user %}     <li><a href="/entelib/users/add/">Add user</a></li> {% endif %}
                        {% if perms.auth.change_user %}  <li><a href="/entelib/users/activate/">Users awaiting activation</a></li> {% endif %}
                    </ul>
                {% endif %}
            </li>
        {% endif %}



        {% if can_list_reports %}              <li><a href="/entelib/report/">                 Reports</a>
          <ul>
            <li><a href="/entelib/report/status/">Library status</a></li>
            <li><a href="/entelib/report/black_list/">Users black list</a></li>
            <li><a href="/entelib/report/lost_books/">Unavailable books</a></li>
            <li><a href="/entelib/report/most_often_rented/">Most often rented books</a></li>
            <li><a href="/entelib/report/most_often_reserved/">Most often reserved books</a></li>
          </ul>
        </li>
        {% endif %}


        {# {% if can_list_locations %} #}
        {% if user.userprofile.is_admin %}
          <li>Administration
            <ul>
              {% if perms.baseapp.list_locations %}  <li><a href="{% url location_all %}">              Location list         </a></li> {% endif %}
              {% if perms.baseapp.add_location %}    <li><a href="{% url location_add %}">              Add location          </a></li>
                <li class="separator"></li>
              {% endif %}
              {% if perms.baseapp.list_buildings %}  <li><a href="{% url building_all %}">              Building list         </a></li> {% endif %}
              {% if perms.baseapp.add_building %}    <li><a href="{% url building_add %}">              Add building          </a></li>
                <li class="separator"></li>
              {% endif %}
              {% if perms.baseapp.list_costcenters %}    <li><a href="/entelib/costcenters/">           Costcenter list       </a></li> {% endif %}
              {% if perms.baseapp.add_costcenter %}      <li><a href="{% url costcenter_add %}">        Add costcenter        </a></li>
                <li class="separator"></li>
              {% endif %}
              {% if perms.baseapp.list_states %}    <li><a href="/entelib/states/">                     State list            </a></li> {% endif %}
              {% if perms.baseapp.add_state %}      <li><a href="{% url state_add %}">                  Add state             </a></li>
                <li class="separator"></li>
              {% endif %}

            </ul>
          </li>
        {% endif %}


        {% if user.userprofile.is_admin %}       <li><a href="/entelib/config/">                 Global configuration</a></li>        {% endif %}

        {% if is_dev %}
          {% if can_access_admin_panel %}        <li><a href="/entelib/admin/">                  Admin panel</a></li>                 {% endif %}
          {% if can_load_default_config %}       <li><a href="/entelib/load_default_config/">    Load default config</a></li>         {% endif %}
        {% endif %}

        {% if can_list_emaillog %}               <li><a href="/entelib/emaillog/">Email logs</a></li>                                 {% endif %}

        <li> <a href='{% url howto %}'>Howto</a></li>
        <li> <a href='{% url feedback %}'>Feedback</a></li>
        <li> <a href="{% url changelog %}">Changelog</a></li>
      </ul>


      </ul>
{% comment %}
<!--
        <ul>
            {% if can_list_books %}                   <li><a href="/entelib/books/">                  Book list</a></li>         {% endif %}
            {% if user.get_profile.is_librarian %}    <li><a href="/entelib/shipment">                Shipment requests</a><li>  {% endif %}
            {% if can_view_own_profile %}             <li><a href="/entelib/profile/rentals/">        My rentals</a></li>        {% endif %}
            {% if can_view_own_profile %}             <li><a href="/entelib/profile/reservations/">   My reservations</a></li>   {% endif %}
            {% if can_view_own_profile %}             <li><a href="/entelib/profile/">                My profile</a></li>        {% endif %}
            {% if can_add_bookrequest %}              <li><a href="/entelib/requestbook/">            Request a book</a></li>    {% endif %}
            {% if user.is_staff %}                    <li><a href="/entelib/config/">                 Configuration</a></li>     {% endif %}
            {% if can_list_users %}                   <li><a href="/entelib/users/">                  User list</a></li>         {% endif %}
            {% if can_list_reports %}                 <li><a href="/entelib/report/">                 Reports</a></li>           {% endif %}
            {% if can_list_locations %}               <li><a href="/entelib/locations/">              Locations</a></li>         {% endif %}
            {% if can_access_admin_panel %}           <li><a href="/entelib/admin/">                  Admin panel</a></li>       {% endif %}
                                                      <li><a href="/entelib/logout/">                 Logout</a></li>
        </ul>
      <ul>
            {% if can_load_default_config %}       <li><a href="/entelib/load_default_config/">Load default config</a></li>   {% endif %}
            {% if can_list_emaillog %}             <li><a href="/entelib/emaillog/">Email logs</a></li>                       {% endif %}
      </ul>
-->
{% endcomment %}

    </div>
{% endblock %}

{% block rest %}
    <div id='content'>
            <div class="goThereWrapper">
                {% block go_back %}
                    <div class="goBackWrapper">
                      <a href="javascript:history.go(-1)">Back</a>
                    </div>
                {% endblock %}
                {% block go_up %}
                    <div class="goUpWrapper">
                        <a href="../">Up</a>
                    </div>
                {% endblock %}
            </div>
        {% block content %}
        {% endblock %}
    </div>
{% endblock %}
